<template>
  <nav-bar class="navbar">
    <img
      src="~assets/img/common/back.svg"
      slot="left"
      class="left"
      @click="goHome"
    />
    <div slot="center" class="center">
      <p
        v-for="(item, index) in chooseList"
        @click="active(index)"
        :class="{ active: index == currentIndex }"
      >
        {{ item }}
      </p>
    </div>
  </nav-bar>
</template>

<script>
import NavBar from "common/navbar/NavBar";
export default {
  name: "Detailbanner",
  components: {
    NavBar,
  },
  props: {
    chooseList: {
      type: Array,
      default: {},
    },
  },
  data() {
    return {
      currentIndex: 0,
    };
  },
  mounted() {},
  methods: {
    goHome() {
      this.$emit("goHome");
    },
    active(index) {
      this.currentIndex = index;
      this.$emit("activeIndex", index);
    },
  },
};
</script>

<style lang="css" scoped>
.navbar {
  height: 44px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}
.center {
  display: flex;
  flex-direction: row;
  justify-content: center;
}
.center p {
  flex: 1;
}
.left {
  height: 22px;
}
.active {
  color: var(--color-high-text);
}
</style>